﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace AnesSystem.Controls.CommonTables.SC.WJYY
{
    /// <summary>
    /// ShuXueAnQuanHuLiJiLuDanCtrl.xaml 的交互逻辑
    /// </summary>
    public partial class JiaoJieHuLiJiLuCtrl : CustomCommonTableCtrl
    {
        public JiaoJieHuLiJiLuCtrl()
        {
            InitializeComponent();
            if (DataManager.Instance.CurrentPatientLink != null)
            {
                if(!DataManager.Instance.CurrentPatientLink.Status.InRoomTime.Equals(new DateTime()))
                {
                    DateTime rssj = DataManager.Instance.CurrentPatientLink.Status.InRoomTime;
                    sssjn.Text = rssj.Year.ToString();
                    sssjy.Text = rssj.Month.ToString();
                    sssjr.Text = rssj.Day.ToString();
                    sssjs.Text = rssj.Hour.ToString();
                    sssjf.Text = rssj.Minute.ToString();

                }
                //rssj.Text = DataManager.Instance.CurrentPatientLink.Status.InRoomTime.Equals(new DateTime()) ? "" : DataManager.Instance.CurrentPatientLink.Status.InRoomTime.ToString(DateFormat.DATE_FORMAT_STR_YMD_CN);
                //sssj.Text = DataManager.Instance.CurrentPatientLink.Status.InPacuTime.Equals(new DateTime()) ? "" : DataManager.Instance.CurrentPatientLink.Status.InPacuTime.ToString(DateFormat.DATE_FORMAT_STR_YMDHM);
            }
            IniteRadioButton();
        }

      
        private void IniteRadioButton()
        {
            new RadioButtonHelper().ChangeRadioSatus(jshzt_jiah, jshzt_ch); new RadioButtonHelper().ChangeRadioSatus(fgn1,fgn2,fgn3);
            new RadioButtonHelper().ChangeRadioSatus(shshs_w, shshs_y); new RadioButtonHelper().ChangeRadioSatus(fgny1, fgny2, fgny3);
            new RadioButtonHelper().ChangeRadioSatus(pf_wh, pf_yc); new RadioButtonHelper().ChangeRadioSatus(bfyp_w, bfyp_y);
            new RadioButtonHelper().ChangeRadioSatus(xil_jl2, xil_kj2); new RadioButtonHelper().ChangeRadioSatus(blzl_ywz2, blzl_bwz2);
            new RadioButtonHelper().ChangeRadioSatus(pf_pj2, pf_jz2); new RadioButtonHelper().ChangeRadioSatus(blzl_w2, blzl_y2);
            new RadioButtonHelper().ChangeRadioSatus(shshs_w2, shshs_y2); new RadioButtonHelper().ChangeRadioSatus(yxzl_w2, yxzl_y2);
            new RadioButtonHelper().ChangeRadioSatus(tc_jl2, tc_kj2); new RadioButtonHelper().ChangeRadioSatus(pf_wh2, pf_yc2);
           new RadioButtonHelper().ChangeRadioSatus(qm2, zgnmz2); 
            new RadioButtonHelper().ChangeRadioSatus(bwt2, sw2); new RadioButtonHelper().ChangeRadioSatus(lfj2, wys2);
            new RadioButtonHelper().ChangeRadioSatus(ssdy_w2, ssdy_y2); new RadioButtonHelper().ChangeRadioSatus(blzl_w, blzl_y);
            new RadioButtonHelper().ChangeRadioSatus(blzl_ywz, blzl_bwz); new RadioButtonHelper().ChangeRadioSatus(yxzl_w, yxzl_y);         
            new RadioButtonHelper().ChangeRadioSatus(tc_jl, tc_kj);
             new RadioButtonHelper().ChangeRadioSatus(qm, zgnmz);
            new RadioButtonHelper().ChangeRadioSatus(bwt, sw); 
            new RadioButtonHelper().ChangeRadioSatus(bwtys, swfs); new RadioButtonHelper().ChangeRadioSatus(lfyn, lffn);
            new RadioButtonHelper().ChangeRadioSatus(bwt, sw);
            new RadioButtonHelper().ChangeRadioSatus();
        }

        private void sj_GotFocus(object sender, RoutedEventArgs e)
        {
            CustomTextCtrl cusText = sender as CustomTextCtrl;
            CusDatePickerWin cusDatePicker = new CusDatePickerWin();
            cusDatePicker.SelectedDateTime = DateTime.Now;
            cusDatePicker.ShowDialog();
            if (cusDatePicker.Result)
            {


                cusText.Value = cusDatePicker.SelectedDateTime.ToString(DateFormat.DATE_FORMAT_STR_YMDHM_CN);//xxxx年xx月xx日
            }

        }
        private void Date_GotFocus(object sender, RoutedEventArgs e)
        {
            CusDatePickerWin cusDatePicker = new CusDatePickerWin();
            cusDatePicker.SelectedDateTime = DateTime.Now;
            cusDatePicker.ShowDialog();
            if (cusDatePicker.Result)
            {
                rqn.Value = cusDatePicker.SelectedDateTime.Year;
                rqy.Value = cusDatePicker.SelectedDateTime.Month;
                rqr.Value = cusDatePicker.SelectedDateTime.Day;
                rqs.Value = cusDatePicker.SelectedDateTime.TimeOfDay.Hours;
                rqf.Value = cusDatePicker.SelectedDateTime.TimeOfDay.Minutes;

                // rq1.Value = cusDatePicker.SelectedDateTime.ToString(DateFormat.DATE_FORMAT_STR_YMDHM_CN);//2005年11月5日
            }
        }
    }
}
